<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0"> 

  <title>PHP: 安装前需要考虑的事项 - Manual </title>

 <link rel="shortcut icon" href="http://php.net/favicon.ico">
 <link rel="search" type="application/opensearchdescription+xml" href="http://php.net/phpnetimprovedsearch.src" title="Add PHP.net search">
 <link rel="alternate" type="application/atom+xml" href="http://php.net/releases/feed.php" title="PHP Release feed">
 <link rel="alternate" type="application/atom+xml" href="http://php.net/feed.atom" title="PHP: Hypertext Preprocessor">

 <link rel="canonical" href="http://php.net/manual/zh/install.general.php">
 <link rel="shorturl" href="http://php.net/manual/zh/install.general.php">
 <link rel="alternate" href="http://php.net/manual/zh/install.general.php" hreflang="x-default">

 <link rel="contents" href="http://php.net/manual/zh/index.php">
 <link rel="index" href="http://php.net/manual/zh/install.php">
 <link rel="prev" href="http://php.net/manual/zh/install.php">
 <link rel="next" href="http://php.net/manual/zh/install.unix.php">

 <link rel="alternate" href="http://php.net/manual/en/install.general.php" hreflang="en">
 <link rel="alternate" href="http://php.net/manual/pt_BR/install.general.php" hreflang="pt_BR">
 <link rel="alternate" href="http://php.net/manual/zh/install.general.php" hreflang="zh">
 <link rel="alternate" href="http://php.net/manual/fr/install.general.php" hreflang="fr">
 <link rel="alternate" href="http://php.net/manual/de/install.general.php" hreflang="de">
 <link rel="alternate" href="http://php.net/manual/ja/install.general.php" hreflang="ja">
 <link rel="alternate" href="http://php.net/manual/ro/install.general.php" hreflang="ro">
 <link rel="alternate" href="http://php.net/manual/ru/install.general.php" hreflang="ru">
 <link rel="alternate" href="http://php.net/manual/es/install.general.php" hreflang="es">
 <link rel="alternate" href="http://php.net/manual/tr/install.general.php" hreflang="tr">

<link rel="stylesheet" type="text/css" href="http://php.net/cached.php?t=1421837618&amp;f=/fonts/Fira/fira.css" media="screen">
<link rel="stylesheet" type="text/css" href="http://php.net/cached.php?t=1421837618&amp;f=/fonts/Font-Awesome/css/fontello.css" media="screen">
<link rel="stylesheet" type="text/css" href="http://php.net/cached.php?t=1478800802&amp;f=/styles/theme-base.css" media="screen">
<link rel="stylesheet" type="text/css" href="http://php.net/cached.php?t=1521070803&amp;f=/styles/theme-medium.css" media="screen">

 <!--[if lte IE 7]>
 <link rel="stylesheet" type="text/css" href="http://php.net/styles/workarounds.ie7.css" media="screen">
 <![endif]-->

 <!--[if lte IE 8]>
 <script type="text/javascript">
  window.brokenIE = true;
 </script>
 <![endif]-->

 <!--[if lte IE 9]>
 <link rel="stylesheet" type="text/css" href="http://php.net/styles/workarounds.ie9.css" media="screen">
 <![endif]-->

 <!--[if IE]>
 <script type="text/javascript" src="http://php.net/js/ext/html5.js"></script>
 <![endif]-->

 <base href="http://php.net/manual/zh/install.general.php">

</head>
<body class="docs ">

<nav id="head-nav" class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <a href="/" class="brand"><img src="/images/logos/php-logo.svg" width="48" height="24" alt="php"></a>
    <div id="mainmenu-toggle-overlay"></div>
    <input type="checkbox" id="mainmenu-toggle">
    <ul class="nav">
      <li class=""><a href="/downloads">Downloads</a></li>
      <li class="active"><a href="/docs.php">Documentation</a></li>
      <li class=""><a href="/get-involved" >Get Involved</a></li>
      <li class=""><a href="/support">Help</a></li>
    </ul>
    <form class="navbar-search" id="topsearch" action="/search.php">
      <input type="hidden" name="show" value="quickref">
      <input type="search" name="pattern" class="search-query" placeholder="Search" accesskey="s">
    </form>
  </div>
  <div id="flash-message"></div>
</nav>
<div class="headsup"><a href='/index.php#id2018-08-30-1'>PHP 7.3.0.beta3 Released</a></div>
<nav id="trick"><div><dl>
<dt><a href='/manual/en/getting-started.php'>Getting Started</a></dt>
	<dd><a href='/manual/en/introduction.php'>Introduction</a></dd>
	<dd><a href='/manual/en/tutorial.php'>A simple tutorial</a></dd>
<dt><a href='/manual/en/langref.php'>Language Reference</a></dt>
	<dd><a href='/manual/en/language.basic-syntax.php'>Basic syntax</a></dd>
	<dd><a href='/manual/en/language.types.php'>Types</a></dd>
	<dd><a href='/manual/en/language.variables.php'>Variables</a></dd>
	<dd><a href='/manual/en/language.constants.php'>Constants</a></dd>
	<dd><a href='/manual/en/language.expressions.php'>Expressions</a></dd>
	<dd><a href='/manual/en/language.operators.php'>Operators</a></dd>
	<dd><a href='/manual/en/language.control-structures.php'>Control Structures</a></dd>
	<dd><a href='/manual/en/language.functions.php'>Functions</a></dd>
	<dd><a href='/manual/en/language.oop5.php'>Classes and Objects</a></dd>
	<dd><a href='/manual/en/language.namespaces.php'>Namespaces</a></dd>
	<dd><a href='/manual/en/language.errors.php'>Errors</a></dd>
	<dd><a href='/manual/en/language.exceptions.php'>Exceptions</a></dd>
	<dd><a href='/manual/en/language.generators.php'>Generators</a></dd>
	<dd><a href='/manual/en/language.references.php'>References Explained</a></dd>
	<dd><a href='/manual/en/reserved.variables.php'>Predefined Variables</a></dd>
	<dd><a href='/manual/en/reserved.exceptions.php'>Predefined Exceptions</a></dd>
	<dd><a href='/manual/en/reserved.interfaces.php'>Predefined Interfaces and Classes</a></dd>
	<dd><a href='/manual/en/context.php'>Context options and parameters</a></dd>
	<dd><a href='/manual/en/wrappers.php'>Supported Protocols and Wrappers</a></dd>
</dl>
<dl>
<dt><a href='/manual/en/security.php'>Security</a></dt>
	<dd><a href='/manual/en/security.intro.php'>Introduction</a></dd>
	<dd><a href='/manual/en/security.general.php'>General considerations</a></dd>
	<dd><a href='/manual/en/security.cgi-bin.php'>Installed as CGI binary</a></dd>
	<dd><a href='/manual/en/security.apache.php'>Installed as an Apache module</a></dd>
	<dd><a href='/manual/en/security.sessions.php'>Session Security</a></dd>
	<dd><a href='/manual/en/security.filesystem.php'>Filesystem Security</a></dd>
	<dd><a href='/manual/en/security.database.php'>Database Security</a></dd>
	<dd><a href='/manual/en/security.errors.php'>Error Reporting</a></dd>
	<dd><a href='/manual/en/security.globals.php'>Using Register Globals</a></dd>
	<dd><a href='/manual/en/security.variables.php'>User Submitted Data</a></dd>
	<dd><a href='/manual/en/security.magicquotes.php'>Magic Quotes</a></dd>
	<dd><a href='/manual/en/security.hiding.php'>Hiding PHP</a></dd>
	<dd><a href='/manual/en/security.current.php'>Keeping Current</a></dd>
<dt><a href='/manual/en/features.php'>Features</a></dt>
	<dd><a href='/manual/en/features.http-auth.php'>HTTP authentication with PHP</a></dd>
	<dd><a href='/manual/en/features.cookies.php'>Cookies</a></dd>
	<dd><a href='/manual/en/features.sessions.php'>Sessions</a></dd>
	<dd><a href='/manual/en/features.xforms.php'>Dealing with XForms</a></dd>
	<dd><a href='/manual/en/features.file-upload.php'>Handling file uploads</a></dd>
	<dd><a href='/manual/en/features.remote-files.php'>Using remote files</a></dd>
	<dd><a href='/manual/en/features.connection-handling.php'>Connection handling</a></dd>
	<dd><a href='/manual/en/features.persistent-connections.php'>Persistent Database Connections</a></dd>
	<dd><a href='/manual/en/features.safe-mode.php'>Safe Mode</a></dd>
	<dd><a href='/manual/en/features.commandline.php'>Command line usage</a></dd>
	<dd><a href='/manual/en/features.gc.php'>Garbage Collection</a></dd>
	<dd><a href='/manual/en/features.dtrace.php'>DTrace Dynamic Tracing</a></dd>
</dl>
<dl>
<dt><a href='/manual/en/funcref.php'>Function Reference</a></dt>
	<dd><a href='/manual/en/refs.basic.php.php'>Affecting PHP's Behaviour</a></dd>
	<dd><a href='/manual/en/refs.utilspec.audio.php'>Audio Formats Manipulation</a></dd>
	<dd><a href='/manual/en/refs.remote.auth.php'>Authentication Services</a></dd>
	<dd><a href='/manual/en/refs.utilspec.cmdline.php'>Command Line Specific Extensions</a></dd>
	<dd><a href='/manual/en/refs.compression.php'>Compression and Archive Extensions</a></dd>
	<dd><a href='/manual/en/refs.creditcard.php'>Credit Card Processing</a></dd>
	<dd><a href='/manual/en/refs.crypto.php'>Cryptography Extensions</a></dd>
	<dd><a href='/manual/en/refs.database.php'>Database Extensions</a></dd>
	<dd><a href='/manual/en/refs.calendar.php'>Date and Time Related Extensions</a></dd>
	<dd><a href='/manual/en/refs.fileprocess.file.php'>File System Related Extensions</a></dd>
	<dd><a href='/manual/en/refs.international.php'>Human Language and Character Encoding Support</a></dd>
	<dd><a href='/manual/en/refs.utilspec.image.php'>Image Processing and Generation</a></dd>
	<dd><a href='/manual/en/refs.remote.mail.php'>Mail Related Extensions</a></dd>
	<dd><a href='/manual/en/refs.math.php'>Mathematical Extensions</a></dd>
	<dd><a href='/manual/en/refs.utilspec.nontext.php'>Non-Text MIME Output</a></dd>
	<dd><a href='/manual/en/refs.fileprocess.process.php'>Process Control Extensions</a></dd>
	<dd><a href='/manual/en/refs.basic.other.php'>Other Basic Extensions</a></dd>
	<dd><a href='/manual/en/refs.remote.other.php'>Other Services</a></dd>
	<dd><a href='/manual/en/refs.search.php'>Search Engine Extensions</a></dd>
	<dd><a href='/manual/en/refs.utilspec.server.php'>Server Specific Extensions</a></dd>
	<dd><a href='/manual/en/refs.basic.session.php'>Session Extensions</a></dd>
	<dd><a href='/manual/en/refs.basic.text.php'>Text Processing</a></dd>
	<dd><a href='/manual/en/refs.basic.vartype.php'>Variable and Type Related Extensions</a></dd>
	<dd><a href='/manual/en/refs.webservice.php'>Web Services</a></dd>
	<dd><a href='/manual/en/refs.utilspec.windows.php'>Windows Only Extensions</a></dd>
	<dd><a href='/manual/en/refs.xml.php'>XML Manipulation</a></dd>
	<dd><a href='/manual/en/refs.ui.php'>GUI Extensions</a></dd>
</dl>
<dl>
<dt>Keyboard Shortcuts</dt><dt>?</dt>
<dd>This help</dd>
<dt>j</dt>
<dd>Next menu item</dd>
<dt>k</dt>
<dd>Previous menu item</dd>
<dt>g p</dt>
<dd>Previous man page</dd>
<dt>g n</dt>
<dd>Next man page</dd>
<dt>G</dt>
<dd>Scroll to bottom</dd>
<dt>g g</dt>
<dd>Scroll to top</dd>
<dt>g h</dt>
<dd>Goto homepage</dd>
<dt>g s</dt>
<dd>Goto search<br>(current page)</dd>
<dt>/</dt>
<dd>Focus search box</dd>
</dl></div></nav>
<div id="goto">
    <div class="search">
         <div class="text"></div>
         <div class="results"><ul></ul></div>
   </div>
</div>

  <div id="breadcrumbs" class="clearfix">
    <div id="breadcrumbs-inner">
          <div class="next">
        <a href="install.unix.php">
          Unix 系统下的安装 &raquo;
        </a>
      </div>
              <div class="prev">
        <a href="install.php">
          &laquo; 安装与配置        </a>
      </div>
          <ul>
            <li><a href='index.php'>PHP 手册</a></li>      <li><a href='install.php'>安装与配置</a></li>      </ul>
    </div>
  </div>




<div id="layout" class="clearfix">
  <section id="layout-content">
  <div class="page-tools">
    <div class="change-language">
      <form action="/manual/change.php" method="get" id="changelang" name="changelang">
        <fieldset>
          <label for="changelang-langs">Change language:</label>
          <select onchange="document.changelang.submit()" name="page" id="changelang-langs">
            <option value='en/install.general.php'>English</option>
            <option value='pt_BR/install.general.php'>Brazilian Portuguese</option>
            <option value='zh/install.general.php' selected="selected">Chinese (Simplified)</option>
            <option value='fr/install.general.php'>French</option>
            <option value='de/install.general.php'>German</option>
            <option value='ja/install.general.php'>Japanese</option>
            <option value='ro/install.general.php'>Romanian</option>
            <option value='ru/install.general.php'>Russian</option>
            <option value='es/install.general.php'>Spanish</option>
            <option value='tr/install.general.php'>Turkish</option>
            <option value="help-translate.php">Other</option>
          </select>
        </fieldset>
      </form>
    </div>
    <div class="edit-bug">
      <a href="https://edit.php.net/?project=PHP&amp;perm=zh/install.general.php">Edit</a>
      <a href="https://bugs.php.net/report.php?bug_type=Documentation+problem&amp;manpage=install.general">Report a Bug</a>
    </div>
  </div><div id="install.general" class="chapter">
 <h1>安装前需要考虑的事项</h1>

 <p class="para">
  安装前，首先需要知道想用 PHP 来做什么。PHP 主要用在三个领域，分别在“<a href="intro-whatcando.php" class="link">PHP 能做什么</a>”一节中进行了描述：
  <ul class="itemizedlist">
   <li class="listitem"><span class="simpara">网站和 web 应用程序（服务器端脚本）</span></li>
   <li class="listitem"><span class="simpara">命令行脚本</span></li>
   <li class="listitem"><span class="simpara">桌面（GUI）应用程序</span></li>
  </ul>
 </p>
 <p class="para">
  在通常情况下，需要三样东西：PHP
  自身、一个 web 服务器和一个 web 浏览器。可能已经有了一个 web
  浏览器，并且根据操作系统的配置，也很可能已经有了一个 web 服务器（例如 Linux 和 MacOS 下的
  Apache；Windows 下的 IIS）。也许在某个公司租用了 web
  空间，这样，自己无需设置任何东西，仅需要编写 PHP
  脚本，并上传到租用的空间中，然后在浏览器中查看结果。
 </p>
 <p class="para">
  如果需要自己配置服务器和 PHP，有两个方法将 PHP 连接到服务器上。对于很多服务器，PHP
  均有一个直接的模块接口（也叫做 SAPI）。这些服务器包括 Apache、Microsoft Internet
  Information Server、Netscape 和 iPlanet 等服务器。其它很多服务器支持
  ISAPI，即微软的模块接口（OmniHTTPd 就是个例子）。如果 PHP 不能作为模块支持 web
  服务器，总是可以将其作为 CGI 或 FastCGI 处理器来使用。这意味着可以使用 PHP
  的 CGI 可执行程序来处理所有服务器上的 PHP 文件请求。
 </p>
 <p class="para">
  如果对 PHP 命令行脚本感兴趣（例如在离线状态下，根据传递给脚本的参数，自动生成一些图片，或处理一些文本文件），那一定需要命令行可执行程序。更多信息可以参考
  <a href="features.commandline.php" class="link">PHP 的命令行模式</a>。如果是这种情况，不需要服务器和浏览器。
 </p>
 <p class="para">
  还可以用 PHP 的 PHP-GTK 扩展来编写桌面图形界面应用程序。这与编写
  web 页面完全不同，因为无需输出任何 HTML，而要管理窗口和窗口中的对象。关于
  PHP-GTK 的更多信息，请<a href="http://gtk.php.net/" class="link external">&raquo;&nbsp;访问专门为该扩展建立的网站</a>。PHP-GTK
  没有包含在官方发布的 PHP 中。
 </p>
 <p class="para">
  现在，本节开始说明如何在 Unix 和 Windows 的 web
  服务器中配置服务器模块接口和 CGI 可执行程序。也将在下面几节中了解到有关命令行可执行程序安装的信息。
 </p>
 <p class="para">
  PHP 源代码包和二进制包可以在
  <a href="http://www.php.net/downloads.php" class="link external">&raquo;&nbsp;http://www.php.net/downloads.php</a>
  找到。建议选择一个最近的<a href="http://www.php.net/mirrors.php" class="link external">&raquo;&nbsp;镜象服务器</a>下载。
 </p>
</div>

<section id="usernotes">
 <div class="head">
  <span class="action"><a href="/manual/add-note.php?sect=install.general&amp;redirect=http://php.net/manual/zh/install.general.php"><img src='/images/notes-add@2x.png' alt='add a note' width='12' height='12'> <small>add a note</small></a></span>
  <h3 class="title">User Contributed Notes </h3>
 </div>
 <div class="note">There are no user contributed notes for this page.</div></section>    </section><!-- layout-content -->
        <aside class='layout-menu'>
    
        <ul class='parent-menu-list'>
                                    <li>
                <a href="install.php">安装与配置</a>
    
                                    <ul class='child-menu-list'>
    
                          
                        <li class="current">
                            <a href="install.general.php" title="安装前需要考虑的事项">安装前需要考虑的事项</a>
                        </li>
                          
                        <li class="">
                            <a href="install.unix.php" title="Unix 系统下的安装">Unix 系统下的安装</a>
                        </li>
                          
                        <li class="">
                            <a href="install.macosx.php" title="Mac OS X 系统下的安装">Mac OS X 系统下的安装</a>
                        </li>
                          
                        <li class="">
                            <a href="install.windows.php" title="Windows 系统下的安装">Windows 系统下的安装</a>
                        </li>
                          
                        <li class="">
                            <a href="install.cloud.php" title="云计算平台上的安装">云计算平台上的安装</a>
                        </li>
                          
                        <li class="">
                            <a href="install.fpm.php" title="FastCGI 进程管理器（FPM）">FastCGI 进程管理器（FPM）</a>
                        </li>
                          
                        <li class="">
                            <a href="install.pecl.php" title="PECL 扩展库安装">PECL 扩展库安装</a>
                        </li>
                          
                        <li class="">
                            <a href="install.problems.php" title="还有问题？">还有问题？</a>
                        </li>
                          
                        <li class="">
                            <a href="configuration.php" title="运行时配置">运行时配置</a>
                        </li>
                            
                    </ul>
                    
            </li>
                        
                    </ul>
    </aside>


  </div><!-- layout -->
         
  <footer>
    <div class="container footer-content">
      <div class="row-fluid">
      <ul class="footmenu">
        <li><a href="/copyright.php">Copyright &copy; 2001-2018 The PHP Group</a></li>
        <li><a href="/my.php">My PHP.net</a></li>
        <li><a href="/contact.php">Contact</a></li>
        <li><a href="/sites.php">Other PHP.net sites</a></li>
        <li><a href="/mirrors.php">Mirror sites</a></li>
        <li><a href="/privacy.php">Privacy policy</a></li>
      </ul>
      </div>
    </div>
  </footer>

    
 <!-- External and third party libraries. -->
 <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="http://php.net/cached.php?t=1421837618&amp;f=/js/ext/modernizr.js"></script>
<script type="text/javascript" src="http://php.net/cached.php?t=1421837618&amp;f=/js/ext/hogan-2.0.0.min.js"></script>
<script type="text/javascript" src="http://php.net/cached.php?t=1421837618&amp;f=/js/ext/typeahead.min.js"></script>
<script type="text/javascript" src="http://php.net/cached.php?t=1421837618&amp;f=/js/ext/mousetrap.min.js"></script>
<script type="text/javascript" src="http://php.net/cached.php?t=1421837618&amp;f=/js/search.js"></script>
<script type="text/javascript" src="http://php.net/cached.php?t=1516300802&amp;f=/js/common.js"></script>

<a id="toTop" href="javascript:;"><span id="toTopHover"></span><img width="40" height="40" alt="To Top" src="/images/to-top@2x.png"></a>

</body>
</html>

